local duanyi = fk.CreateSkill{
    name = "wk_heg__duanyi",
}

Fk:loadTranslationTable{
    ["wk_heg__duanyi"] = "断义",
    [":wk_heg__duanyi"] = "当你首次明置此武将牌后，你摸两张牌，且其他角色明置武将牌后，若其明置武将牌的方式与你首次明置武将牌的方式不同，你可令其弃置两张牌。<br />"..
    "<font color = 'gray'>注：明置武将牌的方式，分为“回合开始时亮将”和“因技能亮将”两种形式。</font>",

    ["wk_heg__duanyi_discard"] = "令 %dest 弃置两张牌",

    ["$wk_heg__duanyi1"] = "尔之于我若无，我之于世若虚。",
    ["$wk_heg__duanyi2"] = "借剑断席，天下无人同我。",
}

duanyi:addEffect(fk.GeneralRevealed,{
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(duanyi.name) then
      for _, v in pairs(data) do
        -- 先这样，藕合过于麻烦
        if table.contains(Fk.generals[v]:getSkillNameList(), duanyi.name)
          or (player:getMark("wk_heg__duanyi") ~= 0 and target ~= player and not target.dead
          and not ((player:getMark("wk_heg__duanyi") == 9 and target.phase == 9) or (player:getMark("wk_heg__duanyi") ~= 9 and target.phase ~= 9))) then
          return true
        end
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    if player:getMark("wk_heg__duanyi") == 0 then
      player:drawCards(2, duanyi.name)
      player.room:setPlayerMark(player, "wk_heg__duanyi", player.phase)
    else
      local choices = {"wk_heg__duanyi_discard::"..target.id, "Cancel"}
      local choice = room:askToChoice(player, {choices = choices, skill_name = duanyi.name})
      if choice ~= "Cancel" then
        room:askToDiscard(target,{
          min_num = 2,
          max_num = 2,
          include_equip = true,
          skill_name = duanyi.name,
          cancelable = false,
        })
      end
    end
  end,
})

return duanyi